<?php
// Luu dieu kien loc hien thoi
	//var_dump($arr_all_recordtype);
	//exit;

if(isset($_REQUEST['hdn_filter'])){
	$v_filter = $_REQUEST['hdn_filter'];
}else{	
	$v_filter = "";
}

$v_enable = "";
if (!$v_is_granted_delete)  {
	$v_enable = "disabled";
}
//$v_recordtype_id = "";
//if(isset($_REQUEST['hdn_recordtype_id'])){
	//$v_recordtype_id= $_REQUEST['hdn_recordtype_id'];
//}

// Luu ten style hien thoi
$v_current_style_name = "odd_row";
// Luu ten style tiep theo
$v_next_style_name = "";
// Luu ten form
$v_form_name = "f_dsp_all_report_type";
$v_goto_url = "list/report/index.php";
$v_count=sizeof($arr_report);

$v_current_item_id = '';
if (isset($_REQUEST['hdn_item_id'])){
	$v_current_item_id = $_REQUEST['hdn_item_id'];
}
?>
<!--bang chua tieu de cua form-->
<table width="100%" cellpadding="0" cellspacing="0" border="0">
	<tr>
		<td class="normal_title"><?php echo CONST_LIST_REPORT_TYPE_TITLE; ?>
			<a id="goto" href="" style=".color:white">#</a>
		</td>
	</tr>
</table>
<!-- bang chua cac tieu thuc loc-->

<table cellpadding="0" cellspacing="0" width="99%">
	<form action="index.php" name="<?php echo $v_form_name;?>" method="post">
	<col width="10%"><col width="50%"><col width="40%">			
		<input name="hdn_report_type_id" type="hidden" value="">
		<input name="hdn_item_id" type="hidden" value="">
		<input name="hdn_list_report_type_id" type="hidden" value="0">
		<input name="hdn_filter" type="hidden" value="<?php echo $v_filter; ?>">
		<input name="fuseaction" type="hidden" value="">
		<input name="hdn_max_order" type="hidden" value="0">
		<input name="hdn_recordtype_id" type="hidden" value="<?php echo $v_recordtype_id; ?>">				
	<tr></tr>
		
	<tr>
		<td align="left" class="normal_label"><?php echo CONST_RECORDTYPE_LABEL;?></td>
		<td colspan="2">
			<select class="normal_selectbox" name="sel_cate" style="width:100%"  message = "<?php echo CONST_RECORDTYPE_MESSAGE; ?>" onChange="sel_cate_onclick(this,document.forms(0).hdn_recordtype_id,'DISPLAY_ALL_REPORT_TYPE')">
    	         <option id="" value="">--<?php echo CONST_RECORDTYPE_SELECT_LABEL;?>--</option>
	            <?php echo _generate_select_option($arr_all_recordtype,'PK_RECORDTYPE','PK_RECORDTYPE','C_NAME', $v_recordtype_id);?>
			</select>
		</td>
	</tr>
	<tr>
		<td class="normal_label" align="right" colspan="3"><?php echo CONST_REPORT_TYPE_FILTER_LABEL;?>
			<input type="text" class="normal_textbox" name="txt_filter_value" value="<?php echo $v_filter; ?>" onKeyDown="txt_filter_keydown()">
			<input type="button" class="small_button" name="btn_filter" value="<?php echo _CONST_FILTER_BUTTON; ?>" onClick="btn_filter_onclick(document.forms(0).hdn_filter,document.forms(0).txt_filter_value,'DISPLAY_ALL_REPORT_TYPE')">
		</td>
	</tr>
</table>
<!-- Bat cac phim: F12=false; Insert=true; Delete=true, ESC=false; Enter=false -->
<div id="hotkey" onKeyDown="javascript:process_hot_key(false,true,true,false,false);">
<!--Bang noi dung chua danh sach cac linh vuc-->
<table class="list_table2" width="100%" cellpadding="0" cellspacing="0">
	<col width="5%"><col width="15%"><col width="40%"><col width="10%"><col width="15%">
	<tr class="header">
		<td align="center">#</td>
		<td align="left"><?php echo CONST_REPORT_TYPE_CODE_LABEL; ?></td>
		<td align="center"><?php echo CONST_REPORT_TYPE_NAME_LABEL; ?></td>		
		<td align="left"><?php echo _CONST_ORDER_LABEL; ?></td>
		<td align="center"><?php echo _CONST_STATUS_COLUMN_HEADER; ?></td>
	</tr>
</table>	
<div style="overflow: auto; width: 100%; height:<?php echo _CONST_HEIGHT_OF_LIST?>;padding-left:0px;margin:0px">
<table class="list_table2" width="100%" cellpadding="0" cellspacing="0">
	<col width="5%"><col width="10%"><col width="45%"><col width="10%"><col width="15%"><?php  
	if ($v_count>0){
		for($row_index = 0;$row_index< $v_count ;$row_index++){
			$v_id = $arr_report[$row_index]['0'];
			$v_code = _replace_bad_char($arr_report[$row_index]['1']);
			$v_name = _replace_bad_char($arr_report[$row_index]['2']);
			$v_order = $arr_report[$row_index]['4'];
			$v_status =$arr_report[$row_index]['3'];
			if ($v_status==1){$v_status=_CONST_STATUS_COLUMN_ACTIVE_VALUE;}else{$v_status=_CONST_STATUS_COLUMN_INACTIVE_VALUE;}
			$v_url = "row_onclick(" . "document.forms(0).hdn_report_type_id"  . "," . $v_id . "," . "'DISPLAY_SINGLE_REPORT_TYPE','" . $v_goto_url . "')";
			if ($v_current_style_name == "odd_row"){
				$v_current_style_name = "round_row";
			}else{
				$v_current_style_name = "odd_row";
			}?>	
			<tr class="<?php echo $v_current_style_name ?>">
				<td align="center">
					<input type="checkbox" name="chk_id" value="<?php echo $v_id; ?>">
				</td>
				<td align="center" onclick="<?php echo $v_url ;?>" class="normal_label">
					<a name="<?php echo $v_id;?>"><?php echo $v_code; ?>&nbsp;</a>
				</td>
				<td align="left" onclick="<?php echo $v_url ;?>" class="normal_label">
					<a name="<?php echo $v_id;?>"><?php echo $v_name; ?>&nbsp;</a>
				</td>
				<td align="center" onclick="<?php echo $v_url ;?>">
					<a name="<?php echo $v_id;?>"><?php echo $v_order; ?>&nbsp;</a>
				</td>
				<td align="center" onclick="<?php echo $v_url ;?>" class="normal_label">
					<a name="<?php echo $v_id;?>"><?php echo $v_status; ?>&nbsp;</a>
				</td>
			</tr><?php 
		}	
	}
	if ($v_current_style_name == "odd_row"){
		$v_next_style_name = "round_row";
	}else{
		$v_next_style_name = "odd_row";
	}
	echo _add_empty_row($v_count,$v_limit,$v_current_style_name,$v_next_style_name,5);
	?>
</table>
</div>

</div id="hotkey">

<table>
	<tr>
		<col width="5%"><col width="95%">
		<td align="center" class="normal_label">
			<b><?php
			//$v_total=9;
			if ($v_total > $v_limit){//(*)
				$url="index.php?fuseaction=DISPLAY_ALL_REPORT_TYPE";
				$url=$url."&hdn_recordtype_id=$v_recordtype_id";
				
				if ($page == 1)  
					echo "<img src=" . $_ISA_IMAGE_URL_PATH . "d-arrow-left.jpg class=normal_image align=center>"; 
				else            
					echo "<a href=\"".$url. "&page=".($page - 1). "\">". "<img src=" . $_ISA_IMAGE_URL_PATH . "arrow-left.jpg class=normal_image align=center>" . "</a>";
				
				for ($i = 1; $i <= $pager->numPages; $i++) { 
					echo " | "; 
					if ($i == $pager->page)
						echo $i; 
					else 
						echo "<a href=\"".$url. "&page=". $i. "\">". $i."</a>";
				}//dong for
				
				if ($page == $pager->numPages) 
					echo " | ". "<img src=" . $_ISA_IMAGE_URL_PATH . "d-arrow-right.jpg class=normal_image align=center>"; 
				else            
					echo " | ". "<a href=\"".$url. "&page=".($page + 1) . "\">" . "<img src=" . $_ISA_IMAGE_URL_PATH . "arrow-right.jpg class=normal_image align=center>" . "</a>";
			}?>
			</b>
		</td>
	</tr>
</table>
<!--Table chua cac button-->
<table align="center">
	<tr><td height="5"></td></tr>
	<tr>
		<td><?php
			if ($v_is_granted_update){?>
				<input type="button" value="<?php echo _CONST_ADD_BUTTON; ?>" name="btn_add" class="normal_button" onClick="btn_add_onclick(document.forms(0).hdn_report_type_id, 'DISPLAY_SINGLE_REPORT_TYPE')"><?php
			}	
			if ($v_is_granted_delete){?>
				<input type="button" value="<?php echo _CONST_DELETE_BUTTON; ?>" name="btn_delete" class="normal_button" onClick="btn_delete_onclick(document.forms(0).chk_id,document.forms(0).hdn_list_report_type_id,'DELETE_REPORT_TYPE')"><?php
			}?>
		</td>
	</tr>
	</form>
</table>

<Script>
	document.all.goto.href="#<? echo $v_current_item_id;?>";
	document.all.goto.click();
	document.forms(0).hdn_max_order.value  ='<?php echo $v_order;?>';
</Script>
	
